package com.xuef.ibatis.io;

import java.io.IOException;
import java.io.InputStream;

/**
 * Created by xuefengDong: moveb
 * On 2020/6/20- 19:20
 */
public class Resources {
    /**
     * 从 classpath 下加载资源文件
     * @param resource
     * @return
     * @throws IOException
     */
    public static InputStream getResourceAsStream(String resource) throws IOException {
        //TODO mybatis classloader 是有层级的
        //而且支持多种途径加载（源不同）
        InputStream resourceAsStream =
                Resources.class.getClassLoader().getResourceAsStream(resource);
        return resourceAsStream;
    }
}
